import 'package:auto_orientation/auto_orientation.dart';
import 'package:bxultimate/data/request/home_request.dart';
import 'package:bxultimate/widgets/video_controls/video_controls.dart';
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:video_player/video_player.dart';

import 'state.dart';

class ArticleDetailController extends GetxController {
  final ArticleDetailState state = ArticleDetailState();

  @override
  Future<void> onInit() async {
    // TODO: implement onInit
    super.onInit();

    await getData();
  }

  getData() async {
    var id = Get.arguments;
    state.article = await HomeRequest.getArticleDetial(id);
    if (state.article.imgUrl != null ) {
      state.imgList = state.article.imgUrl.split(",");
    }
    if(state.article.videoUrl != null){
      state.videoUrl = state.article.videoUrl;
    }


  }
}
